<!DOCTYPE html>
<html>
<head>
    {include file='public/meta'/}


</head>
<body onload="first()">
{include file='public/header'/}
<!------------------导航-------------------------->
<section id="content">
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <div class="page-heading mgr15 mgl15">
            <ul class="breadcrumb">
                <li>当前位置是:</li>
                <li>
                    <a href="{:url('cardus/cardinfo',['card_id'=>$card['card_id']])}">会员卡管理</a>
                </li>
                <li>
                    <a href="javascript:history.back();">会员等级</a>
                </li>
                <li class="active" style="color: #02b87f;">修改会员等级</li>
            </ul>
        </div>
        <div class="panel mgr15 mgl15">
            <form class="form-horizontal adminex-form" action='' method="post">
                <div class="panel-heading addCharts" style="background:#ededed;">
                    会员等级
                </div>
                <div class="panel-body">
                    <div class="form-group">
                        <label class="col-sm-2 col-sm-2 control-label">等级名称：</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name='live_title' id="live_title" value="{$info.live_title}" placeholder="">
                            <div class="error">请输入等级名称，例如白银会员、黄金会员等</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-sm-2 control-label">等级：</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name='live' id="live" value="{$info.live}" placeholder="">
                            <div class="error">请输入等级数字，例如：1</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-sm-2 control-label">所需积分：</label>
                        <div class="col-sm-10">
                            <input type="text" value="{$info.bonus}" class="form-control" name='bonus' id="bonus"
                                   oninput="value = value.replace(/[^\d.]/g, '')" placeholder="">
                            <div class="error">当用户积分达到该数值时则升级为当前等级</div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 col-sm-2 control-label">折扣系数(%)：</label>
                        <div class="col-sm-10">
                            <input type="text" value="{$info.discount}" class="form-control" id="discount"
                                   oninput="value = value.replace(/[^\d.]/g, '')" name='discount' placeholder="">
                            <div class="error">如打8折,则填写80</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-sm-2 control-label">奖励积分：</label>
                        <div class="col-sm-10">
                            <input type="text" value="{$info.reward_bonus}" class="form-control" id="reward_bonus"
                                   oninput="value = value.replace(/[^\d.]/g, '')" name='reward_bonus' placeholder="">
                            <div class="error">达到该等级后,会员会增加对应数额的积分</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-sm-2 control-label">奖励储值：</label>
                        <div class="col-sm-10">
                            <input type="text" value="{$info.reward_balance}" class="form-control"  id="reward_balance"
                                   oninput="value = value.replace(/[^\d.]/g, '')" name='reward_balance' placeholder="">
                            <div class="error">达到该等级后,会员会增加对应数额的储值</div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 col-sm-2 control-label">会员权益：</label>
                        <div class="col-sm-10">
                            <textarea name="welfare" class="form-control" style="resize: none;" id="welfare"
                                      rows="3">{$info.welfare}</textarea>
                            <div class="error"></div>
                        </div>
                    </div>

                </div>
                <div class="panel-footer">
                    <button type="button" class="btn btn-primary" id="add">修改</button>
                </div>
            </form>
        </div>
        {include file='public/footer'/}
    </div>
</section>
</body>
<script>
    //       提交数据
    $("#add").click(function(){
        var live_title = $("#live_title").val();
        var live = $("#live").val();
        var bonus = $("#bonus").val();
        var discount = $("#discount").val();
        var reward_bonus = $("#reward_bonus").val();

        var welfare = $("#welfare").val();
        var reward_balance = $("#reward_balance").val();

        if(live_title == ""){
            layer.alert("请输入等级名称");
            return false;
        }
        if(live == ""){
            layer.alert("请输入等级");
            return false;
        }
        if(bonus == ""){
            layer.alert("请输入所需积分");
            return false;
        }
        if(discount == ""){
            layer.alert("请输入折扣系数");
            return false;
        }
        if(reward_bonus == ""){
            layer.alert("请输入奖励积分");
            return false;
        }
        if(reward_balance == ""){
            layer.alert("请输入奖励储值");
            return false;
        }
        if(welfare == ""){
            layer.alert("请输入会员权益");
            return false;
        }
        $(".adminex-form").submit();
    });
</script>
<!--一级和二级类目选择-->
<script type="text/javascript">
    var primary = document.form.primary;
    var secondary = document.form.secondary;

    function first() {
        //指定first的子元素option的长度
        primary.length = arr_first.length;
        for (var i = 0; i < arr_first.length; i++) {
            primary.options[i].text = arr_first[i].name;
            primary.options[i].value = arr_first[i].value;
        }
        index = primary.selectedIndex;
        secondary.length = arr_second[index].length;
        for (var i = 0; i < arr_second[index].length; i++) {
            secondary.options[i].text = arr_second[index][i].name;
            secondary.options[i].value = arr_second[index][i].value;
        }
    };

    function second_lb() {
        //修改一级类别列表中默认选择项		var index=0;
        //一级类别选中下标
        secondary.length = 0;
        index = primary.selectedIndex;
        secondary.length = arr_second[index].length;
        for (var i = 0; i < arr_second[index].length; i++) {
            secondary.options[i].text = arr_second[index][i].name;
            secondary.options[i].value = arr_second[index][i].value;
        }
    }
</script>

</html>
